<template>
  <form ref="form">
    <!-- 数据双向绑定 -->
    <input type="text" name="username" v-model="form.username"> 
    <br>
    <br>
    <input type="password" name="password" v-model="form.password">
  </form>
</template>
 
<script>
export default {
  data() {
    return {
      form: {
        username: '',
        password: ''
      }
    }
  },
  methods: {
    submit() {
      console.log(this.form.username, this.form.password)
// 清空input框
      this.form.username = ''
      this.form.password = ''
    }
  }
}
</script>

<style scoped>
</style>